paned: Allocate the handle input area properly
authorMatthias Clasen <mclasen@redhat.com>
Wed, 16 Dec 2015 02:06:53 +0000 (21:06 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 16 Dec 2015 02:59:04 +0000 (21:59 -0500)
Drop the margin misuse and use the border allocation of the
handle gadget. We use negative margins to make the border allocation
larger without pushing the paned children out.

gtk/gtkpaned.c
gtk/theme/Adwaita/_common.scss
gtk/theme/Adwaita/gtk-contained-dark.css
gtk/theme/Adwaita/gtk-contained.css

index 7a5940ef36fcae688ab6de773866fe713e0e8434..4aa918420ffc1eeb101a71e09ff146e28a40ebac 100644 (file)
@@ -1498,32 +1498,15 @@ gtk_paned_allocate (GtkCssGadget        *gadget,
 
       if (gtk_widget_get_realized (widget))
        {
-          GtkBorder margin;
-          GtkStyleContext *context = gtk_widget_get_style_context (widget);
-
-          gtk_style_context_get_margin (context,
-                                        gtk_style_context_get_state (context),
-                                        &margin);
+          GtkAllocation border_alloc;
 
          if (gtk_widget_get_mapped (widget))
            gdk_window_show (priv->handle);
 
-          if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-            {
-              gdk_window_move_resize (priv->handle,
-                                      priv->handle_pos.x - margin.left,
-                                      priv->handle_pos.y,
-                                      handle_size + margin.left + margin.right,
-                                      priv->handle_pos.height);
-            }
-          else
-            {
-              gdk_window_move_resize (priv->handle,
-                                      priv->handle_pos.x,
-                                      priv->handle_pos.y - margin.top,
-                                      priv->handle_pos.width,
-                                      handle_size + margin.top + margin.bottom);
-            }
+          gtk_css_gadget_get_border_allocation (priv->handle_gadget, &border_alloc, NULL);
+          gdk_window_move_resize (priv->handle,
+                                  border_alloc.x, border_alloc.y,
+                                  border_alloc.width, border_alloc.height);
        }
 
       /* Now allocate the childen, making sure, when resizing not to
index e8b1e84bba9a7715383df1f8a8b4e158ccf32c14..94fadadd316b9c1672011092122c0bb2cd31f8c8 100644 (file)
@@ -2948,14 +2948,7 @@ placesview {
  * Paned *
  *********/
 
-paned { // this is for the standard paned separator
-
-  -gtk-icon-source: none; // removes handle decoration
-  margin: 0 8px 8px 0; // drag area of the separator, not a real margin
-  &:dir(rtl) {
-    margin-right: 0;
-    margin-left: 8px;
-  }
+paned {
   separator {
     min-width: 1px;
     min-height: 1px;
@@ -2964,6 +2957,18 @@ paned { // this is for the standard paned separator
       background-color: $backdrop_borders_color;
     }
   }
+  &:dir(ltr).horizontal separator {
+    margin: 0 -8px 0 0;
+    padding: 0 8px 0 0;
+  }
+  &:dir(rtl).horizontal separator {
+    margin: 0 0 0 -8px;
+    padding: 0 0 0 8px;
+  }
+  &.vertical separator {
+    margin: 0 0 -8px 0;
+    padding: 0 0 8px 0;
+  }
   separator:selected {
     background-color: $selected_bg_color;
   }
index 4a056fa00a3430a701312cdb0a12fe70689e5102..840f19e118311c712657ec5e9d533b61a9439f17 100644 (file)
@@ -4111,27 +4111,30 @@ placesview row.activatable:hover {
 /*********
  * Paned *
  *********/
-paned {
-  -gtk-icon-source: none;
-  margin: 0 8px 8px 0; }
-  paned:dir(rtl) {
-    margin-right: 0;
-    margin-left: 8px; }
-  paned separator {
-    min-width: 1px;
-    min-height: 1px;
-    background-color: #1c1f1f; }
-    paned separator:backdrop {
-      background-color: #1f2222; }
-  paned separator:selected {
-    background-color: #215d9c; }
-  paned separator.wide {
-    min-width: 5px;
-    min-height: 5px;
-    background-color: transparent;
-    border-style: none solid;
-    border-color: #1c1f1f;
-    border-width: 1px; }
+paned separator {
+  min-width: 1px;
+  min-height: 1px;
+  background-color: #1c1f1f; }
+  paned separator:backdrop {
+    background-color: #1f2222; }
+paned:dir(ltr).horizontal separator {
+  margin: 0 -8px 0 0;
+  padding: 0 8px 0 0; }
+paned:dir(rtl).horizontal separator {
+  margin: 0 0 0 -8px;
+  padding: 0 0 0 8px; }
+paned.vertical separator {
+  margin: 0 0 -8px 0;
+  padding: 0 0 8px 0; }
+paned separator:selected {
+  background-color: #215d9c; }
+paned separator.wide {
+  min-width: 5px;
+  min-height: 5px;
+  background-color: transparent;
+  border-style: none solid;
+  border-color: #1c1f1f;
+  border-width: 1px; }
 
 /**************
  * GtkInfoBar *
index 493aeb7d52234c94d1698274effb77320709e49b..d50b5d9aa986ac6ed91e6d7904ee11811f09b96e 100644 (file)
@@ -4283,27 +4283,30 @@ placesview row.activatable:hover {
 /*********
  * Paned *
  *********/
-paned {
-  -gtk-icon-source: none;
-  margin: 0 8px 8px 0; }
-  paned:dir(rtl) {
-    margin-right: 0;
-    margin-left: 8px; }
-  paned separator {
-    min-width: 1px;
-    min-height: 1px;
-    background-color: #9d9d99; }
-    paned separator:backdrop {
-      background-color: #a5a5a1; }
-  paned separator:selected {
-    background-color: #4a90d9; }
-  paned separator.wide {
-    min-width: 5px;
-    min-height: 5px;
-    background-color: transparent;
-    border-style: none solid;
-    border-color: #9d9d99;
-    border-width: 1px; }
+paned separator {
+  min-width: 1px;
+  min-height: 1px;
+  background-color: #9d9d99; }
+  paned separator:backdrop {
+    background-color: #a5a5a1; }
+paned:dir(ltr).horizontal separator {
+  margin: 0 -8px 0 0;
+  padding: 0 8px 0 0; }
+paned:dir(rtl).horizontal separator {
+  margin: 0 0 0 -8px;
+  padding: 0 0 0 8px; }
+paned.vertical separator {
+  margin: 0 0 -8px 0;
+  padding: 0 0 8px 0; }
+paned separator:selected {
+  background-color: #4a90d9; }
+paned separator.wide {
+  min-width: 5px;
+  min-height: 5px;
+  background-color: transparent;
+  border-style: none solid;
+  border-color: #9d9d99;
+  border-width: 1px; }
 
 /**************
  * GtkInfoBar *